add "cargo xtask local" to run buildomat locally#91
Conversation
0ca9b1b to
8186d35
Compare
|
Rebased to fix merge conflicts. |
| pub key: Option<String>, | ||
| pub security_group: String, | ||
| pub limit_total: usize, | ||
| #[serde(default = "default_false")] |
There was a problem hiding this comment.
I think false is already the Default::default() value for bool isn't it?
There was a problem hiding this comment.
So, while that is correct, I personally prefer to add an explicit default value rather than deferring to Default::default. That way it's obvious what the default value is by glancing at the source code.
If you prefer to replace it with #[serde(default)] I can do the switch.
xtask/src/main.rs
Outdated
| * We are intentionally building the x86_64-unknown-linux-musl variant of | ||
| * the agent. Linux is what the AWS factory configures to run, and the musl | ||
| * variant prevents issues with older glibcs or building on NixOS. | ||
| */ | ||
| eprintln!("building the agent..."); | ||
| let status = cargo() | ||
| .args(["build", "--bin", "buildomat-agent"]) | ||
| .arg("--release") | ||
| .arg("--target=x86_64-unknown-linux-musl") | ||
| .status()?; | ||
| if !status.success() { | ||
| std::process::exit(status.code().unwrap_or(1)); | ||
| } | ||
| std::fs::copy( | ||
| local | ||
| .join("../..") | ||
| .join("target/x86_64-unknown-linux-musl/release/buildomat-agent"), | ||
| local.join("buildomat-agent-linux"), | ||
| )?; |
There was a problem hiding this comment.
I think it would be better if we built the illumos buildomat-agent binary here rather than the Linux one, as that's generally the primary focus here.
There was a problem hiding this comment.
I can change it to also build the illumos one if the current host is illumos, but last time I tried creating a cross-compilation environment from NixOS to illumos I didn't have much success. A Linux MUSL build AFAIK can be done from either Linux or illumos.
There was a problem hiding this comment.
Now xtask always builds the Linux MUSL agent (as the AWS runner configured by xtask-setup uses a Linux image), and if the illumos target is installed for rustc it also builds the illumos agent.
8186d35 to
0b98ab2
Compare
0b98ab2 to
7370a65
Compare
This PR adds the
cargo xtask localfamily of commands to run a local instance of buildomat with minimal configuration.The centerpiece if the
cargo xtask local setupcommand, backed by thextask-setupcrate (it's split fromxtaskas it requires a lot of dependencies). It currently supports configuringbuildomat-server,buildomat-github-server, andbuildomat-factory-aws, and at startup asks which components the user wants to be configured.There are then the
cargo xtask local BINARYcommands, which invokes the binary with the flags required to use the local setup.cargo xtask local buildomatalso gives access to the CLI, pointed to the local server.Other changes included in the PR:
BUILDOMAT_CONFIGenvironment variable to thebuildomatCLI to point to a separate configuration file, so thatcargo xtask local buildomatcan transparently use the correct credentials.